package com.bishe.demo.modules.hotel.hotelPolicy.dao;

import com.bishe.demo.modules.hotel.hotelPolicy.entity.Parking;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface ParkingDao {
    @Insert("insert into hotel_parking values(null,#{allow},#{location})")
    @Options(useGeneratedKeys = true, keyProperty = "parkingId", keyColumn = "parking_id")
    void insertParking(Parking parking);

    @Select("select * from hotel_parking hp left join hotel_policy_parking hpp on hpp.parking_id=hp.parking_id where hpp.policy_id=#{policyId}")
    Parking getParkingByPolicyId(int policyId);

    @Delete("delete from hotel_parking where parking_id=#{parkingId}")
    void deleteByParkingId(int parkingId);
}
